package net.sf.midollo.net.cgitunnel.client;

import java.io.IOException;

import net.sf.midollo.io.IOStream;
import net.sf.midollo.io.IOStreamFactory;

public class CGITunnelClientIOStreamFactory implements IOStreamFactory {

  protected final IOStreamFactory ioStreamFactory;
  protected final String host;
  protected final int port;

  public CGITunnelClientIOStreamFactory(IOStreamFactory ioStreamFactory, String host, int port) {
    this.ioStreamFactory = ioStreamFactory;
    this.host = host;
    this.port = port;
  }

  public IOStream open() throws IOException {
    CGITunnelConnection connetion = new CGITunnelConnection(this.ioStreamFactory, this.host, this.port);
    return new CGITunnelClientIOStream(connetion);
  }
}
